package player.ui.tree;

import java.io.File;

import javax.swing.tree.TreePath;



public class FileTree extends MyJTree{
	private static final long serialVersionUID = 8598209969628450862L;
	
	public FileSystemTreeModel treeModel ;
	Thread paintThread;
	boolean waitPaint=false;
	boolean repaintNow=false;
	long lastPaintTime=0;
	long paintInterval=1000;
	
	boolean needPaint=false;
	public FileTree(){
		super();
		treeModel=new FileSystemTreeModel();
		setModel(treeModel);
	}
	
	 void tryOpenDir(String[] path){
		if(path!=null){
			Object o=treeModel.getChild(treeModel.getRoot(), 0);
			Object o2=treeModel.getChild(o, 1);

			Object[] ob=new Object[path.length+1];
			ob[0]=treeModel.getRoot();
			for(int i=0;i<path.length;i++){
				if(path[i].equals(o2.toString())){
					ob[i+1]=o2;
					continue;
				}
				ob[i+1]=new File(path[i]);
			}
			TreePath path2=new TreePath(ob);
			expandPath(path2);
			//scrollPathToVisible(path2);
			setSelectionPath(path2);
		}
	}
	 
	 
}
